<template>
  <view class="page">
    <!-- 顶部导航 -->
    <view class="header">
      <view class="nav-bar">
        <image 
          class="back-icon" 
          src="/static/recharge/d2d56def1b7e4daac7adad19dc740323.png" 
          @tap="handleBack"
        />
        <text class="title">充值记录</text>
      </view>
    </view>

    <!-- 记录列表 -->
    <view class="record-list" v-if="recordList.length > 0">
      <view class="record-item" v-for="(item, index) in recordList" :key="index">
        <view class="left">
          <text class="amount">+{{item.amount}}</text>
          <text class="time">{{item.time}}</text>
        </view>
        <view class="right">
          <text class="status" :class="item.status">{{item.statusText}}</text>
        </view>
      </view>
    </view>

    <!-- 空状态 -->
    <view class="empty-state" v-else>
      <image class="empty-image" src="/static/order/e186e04e8774da64b58c96a8bb479840.png" />
      <text class="empty-text">暂无充值记录～</text>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      recordList: [
        {
          amount: 100,
          time: '2024-03-15 12:30:45',
          status: 'success',
          statusText: '充值成功',
          gift: 12 // 赠送金额
        },
        {
          amount: 200,
          time: '2024-03-14 15:20:33',
          status: 'success', 
          statusText: '充值成功',
          gift: 30
        },
        {
          amount: 50,
          time: '2024-03-13 18:10:22',
          status: 'failed',
          statusText: '充值失败',
          gift: 5
        }
      ]
    }
  },

  methods: {
    handleBack() {
      uni.navigateBack()
    }
  }
}
</script>

<style lang="scss" scoped>
.page {
  min-height: 100vh;
  background: #f8f8f8;
}

.header {
  background: #fff;
  padding-top: 88rpx;
  
  .nav-bar {
    position: relative;
    height: 88rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    
    .back-icon {
      position: absolute;
      left: 30rpx;
      width: 48rpx;
      height: 48rpx;
      padding: 10rpx;
    }
    
    .title {
      font-size: 32rpx;
      color: #333;
      font-weight: bold;
    }
  }
}

.record-list {
  padding: 20rpx;
  
  .record-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-radius: 16rpx;
    padding: 30rpx;
    margin-bottom: 20rpx;
    
    .left {
      .amount {
        font-size: 36rpx;
        color: #333;
        font-weight: bold;
        display: block;
        margin-bottom: 8rpx;
      }
      
      .time {
        font-size: 24rpx;
        color: #999;
      }
    }
    
    .right {
      .status {
        font-size: 26rpx;
        padding: 4rpx 12rpx;
        border-radius: 8rpx;
        
        &.success {
          color: #8cd548;
          background: rgba(140, 213, 72, 0.1);
        }
        
        &.failed {
          color: #ff4444;
          background: rgba(255, 68, 68, 0.1);
        }
      }
    }
  }
}

.empty-state {
  padding-top: 200rpx;
  display: flex;
  flex-direction: column;
  align-items: center;
  
  .empty-image {
    width: 400rpx;
    height: 300rpx;
    margin-bottom: 40rpx;
  }
  
  .empty-text {
    font-size: 28rpx;
    color: #999;
  }
}
</style> 